home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pru_generator.cog < prev    next >
Text File  |  1999-11-15  |  1KB  |  69 lines

  1. # Jones 3D Cog Script
  2. #
  3. # PRU_Generator2.COG
  4. #
  5. # Simplified single-enemy generator triggered by entering a sector
  6. # Useful to prevent early enemy wakeup, slow framerates at long distances, etc.
  7. #
  8. # [RKD] [GGJ]
  9. #
  10. # (C) 1998 LucasArts Entertainment Co. All Rights Reserved
  11. # ========================================================================================
  12. symbols
  13.  
  14. message    entered
  15. message timer
  16. message    killed
  17.  
  18. sector        trigger
  19. thing        generator_pos    nolink                    desc=generator_ghost
  20. template    enemy_tpl                                desc=enemy_to_generate
  21. int            population=0        local
  22. int            newEnemy            local        mask=0x004
  23. int            enemy                local
  24.  
  25. end
  26. # ........................................................................................
  27. code
  28.  
  29. entered:
  30. Print("entered");
  31.     if (population >= 2) return;
  32.     
  33.     Print("population is");
  34.     PrintInt(population);
  35.     
  36.     enemy = CreateThing(enemy_tpl, generator_pos);
  37.     CaptureThing(enemy);
  38.     population = population + 1;
  39.     SetTimer(2.0);
  40.     return;
  41.     
  42. Timer:
  43. Print("timer");
  44.     if (population >= 2)    return;
  45.  
  46.     Print("population is");
  47.     PrintInt(population);
  48.  
  49.     Sleep(Rand() * 10);
  50.     newEnemy = CreateThing(enemy_tpl, generator_pos);
  51.     CaptureThing(newEnemy);
  52.     population = population + 1;
  53.     SetTimer(1.0);
  54.     return;
  55.     
  56. killed:
  57.     Print("killed");
  58.     population = population - 1;
  59.     if (population <= 1)
  60.     {
  61.         SetTimer(1.0);
  62.     }
  63.     
  64.     Print("population is");
  65.     PrintInt(population);
  66.  
  67.     return;
  68. end
  69.